import request from '@/utils/request'

/**
 * @description:
 * @param {*}
 * @return {*}
 */
//  获取全部员工数据
export function getEmployees(params) {
  return request({
    url: '/sys/user',
    methods: 'get',
    params
  })
}

/**
 * @description: 添加员工
 * @param {*} data
 * @return {*}
 */
export function addEmployees(data) {
  return request({
    method: 'post',
    url: '/sys/user',
    data
  })
}

/**
 * @description: 删除员工
 * @param {*} data
 * @return {*}
 */
export function delEmployees(id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}

/**
 * @description: 导入excel
 * @param {*} data
 * @return {*}
 */
export function importEmployee(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

/**
 * @description: 保存员工信息
 * @param {*} data
 * @return {*}
 */
export function saveUserDetailById(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * @description: 获取用户的详细情况（用户的头像）
 * @param {*} data
 * @return {*}
 */
export function getUserByIdDetail(id) {
  return request({
    url: `/sys/user/${id}`
  })
}

export function getJobDetail(id) {
  return request({
    url: `/employees/${id}/jobs`,
    method: 'get'
  })
}
